﻿using PFMConfigurations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PFMKernels
{
    public class PFMCoordinator
    {
        PFMConfigurationManager o_ConfigurationsManager = null;
        PFMTaskDispatcher o_FDispatcher = null;
        public PFMCoordinator()
        {
            o_ConfigurationsManager = new PFMConfigurations.PFMConfigurationManager();
            o_FDispatcher = new PFMTaskDispatcher();
            DoSetups();

        }
        protected void DoSetups()
        {
            //初始化工作，目前没有内容
        }
        public void DoSpecifiedTask(Target aTarget)
        {
            o_FDispatcher.DoSpecifiedTask(this.o_ConfigurationsManager, aTarget);

        }
        public void DoScheduledTask(DateTime aDT)
        {
            List<Schedule> schedulesList = o_ConfigurationsManager.FindScheduleds(aDT);
            try
            {
                o_FDispatcher.DoScheduledTask(o_ConfigurationsManager, schedulesList);

            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public PFMConfigurationManager ConfigurationsManager
        {
            get { return o_ConfigurationsManager; }
        }
    }
}
